< previous page page_711 next page >

Page 711
The rdoQuery Object
The rdoQuery object provides a method for creating and executing defined queries or views on the remote data source. The rdoQuery object is the RDO version of the Microsoft Jet QueryDef object. You can create more than one rdoQuery object on each rdoConnection object. All rdoQuery objects are accessed through the rdoQueries collection object.
Add a new button to the form. Set its Name to cmdRDOQueries and its Caption to RDO Queries. Add the code in Listing 18.13 to the cmdRDOQueries_Click event.
Type.gifListing 18.13. Coding for the cmdRDOQueries_Click event.
Private Sub cmdRDOQueries_Click()
    '
    ' example rdo query
    '
    Dim rdoEnv As rdoEnvironment
    Dim rdoCon As rdoConnection
    Dim rdoQry As rdoQuery
    Dim rdoNewQry As rdoQuery
    Dim rdoRS As rdoResultset
    Dim strMsg As String
    Dim strSQL As String
    Dim aryLockType As Variant
    Dim aryType As Variant
    Dim aryCursorDriver As Variant
    '
    aryCursorDriver = Array("rdUseIfNeeded", "rdUseOdbc", "rdUseServer",
arrow.gif"rdUseClientBatch", "rduseNone")
    aryLockType = Array("rdConcurReadOnly", "rdConcurLock", "rdConcurRowVer",
arrow.gif"rdConcurValues", "rdConCurBatchEdit")
    aryType = Array("rdOpenForwardOnly", "rdOpenKeyset", "rdOpenDynamic",
arrow.gif"rdOpenStatic")
    '
    strSQL = "SELECT * FROM Publishers,Titles WHERE
arrow.gifPublishers.PubID=Titles.PubId"
    '
    ' set env/con
    Set rdoEnv = rdoEngine.rdoCreateEnvironment("rdoTEMP", "admin", "")
    Set rdoCon = rdoEnv.OpenConnection("RDC Books5")
    '
    ' build a new query & collect data set
    Set rdoNewQry = rdoCon.CreateQuery("rdoQryTest", strSQL)
    Set rdoRS = rdoNewQry.OpenResultset()
    '
    ' show details
    For Each rdoQry In rdoCon.rdoQueries
        strMsg = strMsg & "BindThreshold=" & CStr(rdoQry.BindThreshold) & vbCrLf
        strMsg = strMsg & "CursorType=" & aryCursorDriver(rdoQry.CursorType) &
arrow.gifvbCrLf
        strMsg = strMsg & "hStmt=" & CStr(rdoQry.hStmt) & vbCrLf
        strMsg = strMsg & "KeysetSize=" & CStr(rdoQry.KeysetSize) & vbCrLf
continues

 
< previous page page_711 next page >

If you like this book, buy it!